<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="安装单打印" />
<%@ include file="../inc/PrintTitle.jsp"%>
<head>
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doPrint(){
		ShowConfirm('确认框','确定开始打印吗？',340,80,"doPrintCallBack()");
	}
	function doPrintCallBack(){
		if(popRetVal!=null){
			document.getElementById("noPrinSpan").style.display="none";
			printContent("管理易-安装单","${enterpriseInfo.doPrint}","${enterpriseInfo.printWidth}");
			document.getElementById("noPrinSpan").style.display="";
		}
	}
	function doCancel(){
		window.close();
	}
	function printImageOnload(obj){
		obj.style.display="";//现在才显示，避免先会把页面撑大,再缩小
		obj.width=obj.width>300?300:obj.width;//要放在display后，否则width=0
	}
	function doWord(){
		window.location="SetuBillPrint.ihtm?id=${record.setuBill.id}&content_type=WORD";
	}
</script>
</head>
<body style="background-color:#FFFFFF">
<table width="100%" border="0"  align="center" cellpadding="0" cellspacing="0">
	<tr>
		<td>
			<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
				<tr>
					<td width="16%" rowspan="2"><img src="${enterpriseInfo.loginImage}" /></td>
					<td width="68%" height="40px" align="center" class="FontLarge_Bold">${licenseInfo.enterpriseName} 安装单</td>
					<td width="16%">&nbsp;</td>
				</tr>
				<tr>
					<td colspan="2" align="right" valign="bottom">
						<div id="barcodeTarget"></div>
						<div class="FontSmall" style="padding-right:8px;">${record.clientCode}&nbsp;&nbsp;NO.&nbsp;${record.setuBill.billCode}</div>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="ListTable">
				<tr class="ListTrPrint">
			      	<td class="FontSmall" width="40%"><b>订货单位</b>：${record.clientName}</td>
			      	<td class="FontSmall" width="30%"><b>联系人</b>：${record.setuBill.lm} ${record.setuBill.phon}</td>
			      	<td class="FontSmall" width="30%"><b>业务单号</b>：${record.bbCode}</td>
				</tr>
		  	</table>
		</td>
	</tr>
	<tr>
		<td height="3"></td>
	</tr>
	<tr>
		<td>
			<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="small_border">
				<tr class="ListTrPrint">
					<td width="10%" class="FontSmall_Bold" align="center">项目类型</td>
					<td width="12%" class="FontSmall_Bold" align="center">内容</td>
					<td width="12%" class="FontSmall_Bold" align="center">材质</td>
					<td width="12%" class="FontSmall_Bold" align="center">规格</td>
					<td width="16%" class="FontSmall_Bold" align="center">制作要求</td>
					<td width="8%" class="FontSmall_Bold" align="center">订货数量</td>
					<td width="8%" class="FontSmall_Bold" align="center">本次安装</td>
					<td width="8%" class="FontSmall_Bold" align="center">单位</td>
					<td width="14%" class="FontSmall_Bold" align="center">备注</td>
				</tr>
				<c:forEach var="item" items="${record.items}" varStatus="i">
				<tr class="ListTrPrint">
					<td class="FontSmall" align="center">${item.makeTypeName}</td>
					<td class="FontSmall" align="center">${item.finishedContent}</td>
					<td class="FontSmall" align="center"><c:out value="${item.productName}" /></td>
					<td class="FontSmall" align="center">${item.specification}</td>
					<td class="FontSmall" align="center">${item.makeRequire}</td>
					<td class="FontSmall" align="center"><commonTag:parseBigDecimal source="${item.amountTotal}" /></td>
					<td class="FontSmall" align="center"><commonTag:parseBigDecimal source="${item.setuBillItem.amount}" /></td>
					<td class="FontSmall" align="center">${item.unit}</td>
					<td class="FontSmall" align="center">${item.setuBillItem.mark}</td>
				</tr>
				</c:forEach>
		  </table>
		</td>
	</tr>
	<tr>
		<td height="3"></td>
	</tr>
	<c:if test="${enterpriseInfo.setuPrintImage=='Y'}">
	<tr>
		<td>
			<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="small_border">
				<tr class="ListTrPrint">
			      	<td class="FontSmall_Bold" align="center" <c:if test="${record.setuBill.compImg!=null && record.setuBill.compImg!=''}">width="50%"</c:if>>小样效果图</td>
			      	<c:if test="${record.setuBill.compImg!=null && record.setuBill.compImg!=''}">
			      	<td class="FontSmall_Bold" align="center" width="50%">完工后照片</td>
			      	</c:if>
				</tr>
				<tr class="ListTrPrint">
			      	<td class="FontSmall" style="text-align:center" height="200px"><c:if test="${record.setuBill.examImg!=null && record.setuBill.examImg!=''}"><img src="${record.setuBill.examImg}" style="display:none" onload="printImageOnload(this);"></c:if></td>
			      	<c:if test="${record.setuBill.compImg!=null && record.setuBill.compImg!=''}">
			      	<td class="FontSmall" style="text-align:center"><img src="${record.setuBill.compImg}" style="display:none" onload="printImageOnload(this);"></td>
			      	</c:if>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td height="3"></td>
	</tr>
	</c:if>
	<tr>
		<td>
			<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="small_border">
				<tr class="ListTrPrint">
			      	<td class="FontSmall" width="50%"><b>派单日期</b>：<fmt:formatDate value="${record.setuBill.billDate}" pattern="yyyy-MM-dd HH:mm"/> ${record.setuBill.creaName}</td>
			      	<td class="FontSmall" width="50%"><b>应完工日期</b>：<fmt:formatDate value="${record.setuBill.planDate}" pattern="yyyy-MM-dd HH:mm"/></td>
				</tr>
				<tr class="ListTrPrint">
			      	<td class="FontSmall"><b>项目总金额</b>：${record.setuBill.cost}</td>
			      	<td class="FontSmall"><b>余额</b>：${record.setuBill.remaCost}（安装后付款）</td>
				</tr>
				<tr class="ListTrPrint">
			      	<td class="FontSmall" colspan="2"><b>安装地址</b>：${record.setuBill.addr}</td>
				</tr>
				<tr class="ListTrPrint">
			      	<td class="FontSmall" colspan="2"><b>安装要求</b>：${record.setuBill.requ}</td>
				</tr>
				<tr class="ListTrPrint">
			      	<td class="FontSmall" colspan="2">
			      		<b>安装配备</b>：
			      		<c:if test="${record.setuBill.needCar=='Y'}">需要派车</c:if>
				    	<c:if test="${record.setuBill.needHigh=='Y'}">高空作业</c:if>
				    	<c:if test="${record.setuBill.needWeld=='Y'}">焊接作业</c:if>
				    	<c:if test="${record.setuBill.needStee=='Y'}">不锈钢</c:if>
			      	</td>
				</tr>
				<tr class="ListTrPrint">
			      	<td class="FontSmall" colspan="2" height="40px"><b>备注</b>：${record.setuBill.mark}</td>
				</tr>
				<tr class="ListTrPrint">
			      	<td class="FontSmall" colspan="2" height="40px"><b>注意事项</b>：</td>
				</tr>
		  	</table>
		</td>
	</tr>
	<tr>
		<td height="3"></td>
	</tr>
	<tr>
		<td>
			<table width="98%" border="0" cellspacing="1" cellpadding="1" align="center" class="small_border">
				<tr class="ListTrPrint">
					<td class="FontSmall" width="40%" height="40px"><b>参加安装人员</b>：${record.setuBill.setuNameStr}</td>
					<td class="FontSmall_Bold" width="30%">接单人签字：</td>
					<td class="FontSmall_Bold" width="30%">安装负责人签字：</td>
				</tr>
				<tr class="ListTrPrint">
					<td class="FontSmall_Bold" height="40px">客户签字：</td>
					<td class="FontSmall_Bold" colspan="2">是否满意（请打“√” &nbsp;&nbsp;满意&nbsp;&nbsp;基本满意&nbsp;&nbsp;不满意）</td>
				</tr>
				<tr class="ListTrPrint">
					<td class="FontSmall_Bold" colspan="3" height="40px">&nbsp;</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td height="3"></td>
	</tr>	
	<c:if test="${codeRule.printFoot!=null && codeRule.printFoot!=''}">
	<tr>
		<td>
			<table width="98%" border="0" cellspacing="1" cellpadding="1" align="center">
				<tr>
					<td class="FontSmall"><commonTag:parseEnterToBr source="${codeRule.printFoot}" /></td>
				</tr>
			</table>
		</td>
	</tr>
	</c:if>
	<tr id="noPrinSpan">
		<td>
			<table width="98%" border="0" cellspacing="1" cellpadding="1" align="center">
				<tr>
					<td>
						<input type="button" id="printButton" class="Button" value=" 开始打印" onClick="doPrint();">
						<input type="button" id="printButton" class="Button" value=" 导出Word" onClick="doWord();">
						<input type="button" id="cancelButton" class="Button" value=" 退 出 " onClick="doCancel();">
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</body>
</html>
<c:if test="${enterpriseInfo.setuBc=='Y'}">
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/jquery-barcode.js"></script>
<script language="javascript">
	var settings = {
			output: "css",
          	showHRI: false,
          	bgColor: "#FFFFFF",
      		color: "#000000",
          	barWidth: 1,
          	barHeight: 30
	};
	var value="${record.setuBill.billCode}";
	//var btype="code39";
	var btype="code128";
	$("#barcodeTarget").html("").show().barcode(value, btype, settings);
</script>
</c:if>